using System;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Serialization;

namespace Commons.Models.Settings.Dtos.TradeValues
{
	public class RewardDto : MultipleTradeValueDto
	{
		[XmlElement(ElementName = "stats", Namespace = "http://www.ibeltran.com/schema/game/tradevalue")]
		public List<UserStatTradeValueDto> Stats;
        
        [XmlElement(ElementName = "probability", Namespace = "http://www.ibeltran.com/schema/game/tradevalue")]
		public List<ProbabilityTradeValueDto> Probability;

		protected List<TradeValueDto> tradeValues;

		override public List<TradeValueDto> GetTradeValues()
		{
			if (tradeValues == null)
			{
				tradeValues = new List<TradeValueDto>();

				if (Stats != null)
				{
					foreach (UserStatTradeValueDto userStatTradeValueDto in Stats)
					{
						tradeValues.Add(userStatTradeValueDto);
					}
				}

				if (Probability != null)
				{
					foreach (ProbabilityTradeValueDto probabilityTradeValueDto in Probability)
					{
						tradeValues.Add(probabilityTradeValueDto);
					}
				}
			}

			return tradeValues;	
		}
	}
}
